﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Themes/Fantasy/Views/Shared/Site.Master" %>
<%@ Import Namespace="AFDS.BusinessLogic" %>
<%@ Import Namespace="AFDS.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<% Html.RenderPartial("AFDSSubMenu");%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">    
<% var categories = (ViewData["Categories"] as List<Category>); %>
<fieldset class="MvcMembership">
<% Html.BeginForm("CategoryList", "AFDSAdmin"); %>
	<legend><h1>Categories</h1></legend><br />
	<% if (categories != null && categories.Count > 0)
    { %>
    
	<table width="100%" cellspacing=2>
	    <tr style="background-color: #c9cccd; height: 14px; text-align:center; font-weight: bold;">
            <td>Name:</td><td>Description:</td><td>AllowSites:</td><td>Enable:</td><td>Parent Category:</td><td>Action:</td>
        </tr>        	
		<%               
        foreach (var c in categories)
        {%>             
                <tr>
		            <td><% = c.Name%></td>
		            <td><% = c.Description%></td>
		            <td><%=Html.CheckBox("allowsites", c.AllowSites, (object)new { @disabled = "disabled" })%></td>
		            <td><%=Html.CheckBox("isenabled", c.Enable, (object)new { @disabled = "disabled" })%></td>
		            <td><% = c.ParentId%></td>
		            <td><%= Html.ActionLink("EDIT", "EditCategoryForm/edit", "Admin", new { id = c.Id.ToString() }, null)%> - <%= Html.ActionLink("DELETE", "EditCategoryForm/delete", "Admin", new { id = c.Id.ToString() }, null)%></td>
		        </tr> 				
<%     }         
        
%>
	<% }else{ %>
	<tr>
	    <td colspan="6">
	        	<p>No Categories have been entered into the system yet.</p>
	    </td>
	</tr>
	<% } %>	
	<tr>
	    <td colspan="6" style="padding-top:8px;">
            <%= Html.ActionLink("Create a New Category", "EditCategoryForm/add", "Admin", new { id = "0" }, null)%>
	    </td>
	</tr>			
</table>	
<% Html.EndForm(); %>
</fieldset>

</asp:Content>

